namespace FIREFLYX {
    /** 触摸输入管理器 */
    export class TouchManager {
        public static instance: TouchManager = new TouchManager();

        public init(list: [string, () => any][]) {
            list.push(["touchstart", this._touchStart.bind(this)]);
            list.push(["touchmove", this._touchMove.bind(this)]);
            list.push(["touchend", this._touchEnd.bind(this)]);
            list.push(["touchcancel", this._touchCancel.bind(this)]);
        }

        private _touchStart(e: TouchEvent) {
            GlobalEventManager.Instance.dispatchEvent("touchstart", e);
        }
        private _touchMove(e: TouchEvent) {
            GlobalEventManager.Instance.dispatchEvent("touchmove", e);
        }
        private _touchEnd(e: TouchEvent) {
            GlobalEventManager.Instance.dispatchEvent("touchend", e);
        }
        private _touchCancel(e: TouchEvent) {
            GlobalEventManager.Instance.dispatchEvent("touchcancel", e);
        }
    }
}
